#include "titlescreen.h"

TitleScreen::TitleScreen()
{
    title_image.load("grafx/titlescreen/titlescreen.png");
    mountain.load("grafx/titlescreen/mountain.png");
    sword.load("grafx/titlescreen/sword.png");

    start_image.load("grafx/titlescreen/start.png");
    continue_image.load("grafx/titlescreen/continue.png");
    options_image.load("grafx/titlescreen/options.png");

    selection_state=1;

    mountainscroll = 500;
    swordscroll = -900;

    //music->create_audio_thread( "sounds/titlescreen/titlescreen.ogg", "LF" );

    level_alive = true;
}

void TitleScreen::draw()
{
    if(mountainscroll > -93)
        mountainscroll-=7;
    if(swordscroll !=-0)
        swordscroll+=10;

    title_image.draw(0,0);

    switch (selection_state)
    {
            case 1:
                    start_image.draw(320,190);
                break;
            case 2:
                    continue_image.draw(320,190);
                break;
            case 3:
                    options_image.draw(320,190);
                break;
            default:
                break;
    }
    swordmove();
    mountainmove();


}

void TitleScreen::start_game()
{
     level_alive = false;
}

void TitleScreen::mountainmove()
{
    mountain.draw(mountainscroll,217);
}

void TitleScreen::swordmove()
{
    sword.draw(swordscroll,0);
}


void TitleScreen::moveup()
{
    if(selection_state != 1)
        selection_state--;

}

void TitleScreen::movedown()
{
    if(selection_state !=3)
        selection_state++;

}

TitleScreen::~TitleScreen()
{
    cout << "bye titlescreen\n";
    //delete titlemusic;
}

